$(document).ready(function() {
		$("#loginForm").validate();
	});
$(function(){
	
	$("#submit_btn").click(function() {
		
		if(!$("#loginForm").valid()) {
			return;
		}
		
		var formUrl = $("#loginForm").attr("action");
		var formParam = $("#loginForm").serialize();
		$.post(formUrl, formParam, function(result) {
			if(result.code == 1) {
				$("#message").html(result.message)
							 .show();
				$("#captcha").click();
				$("#imgCode").val("");
			}else if(result.code == 0) {
				layer.msg("登录成功", {icon: 1, time: 1000},function() {
					window.location.href = url.MAIN;
						return;
				  });
			}
		})
		return false;
	});
});